package com.heima.behavior.controller;


import com.heima.behavior.service.*;
import com.heima.model.behavior.dtos.*;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1")
public class ApBehaviorController {

    @Autowired
    ApLikesBehaviorService apLikesBehaviorService;

    @PostMapping("/likes_behavior")
    public ResponseResult likes(@RequestBody LikesBehaviorDTO dto){
       return apLikesBehaviorService.like(dto);
    }

    @Autowired
    ApReadBehaviorService apReadBehaviorService;
    @PostMapping("read_behavior")
    public ResponseResult read(@RequestBody ReadBehaviorDTO dto){
      return   apReadBehaviorService.readBehavior(dto);
    }

    @Autowired
    ApUnlikeBehaviorService apUnlikeBehaviorService;
    @PostMapping("/un_likes_behavior")
    public ResponseResult unlike(@RequestBody UnLikesBehaviorDTO dto){
      return   apUnlikeBehaviorService.unlikeBehavior(dto);
    }

    @Autowired
    ApCollectionBehaviorService apCollectionBehaviorService;

    @PostMapping("/collection_behavior")
    public ResponseResult collection(@RequestBody CollectionBehaviorDTO dto){
      return   apCollectionBehaviorService.collectBehavior(dto);
    }


    @Autowired
    ApArticleBehaviorService apArticleBehaviorService;

    @PostMapping("/article/load_article_behavior")
    public ResponseResult load(@RequestBody ArticleBehaviorDTO dto){
      return   apArticleBehaviorService.loadArticleBehavior(dto);
    }

}
